<?php /*a:2:{s:64:"D:\laragon\www\jiaqueshop\application\manage\view\spike_add.html";i:1567410433;s:59:"D:\laragon\www\jiaqueshop\application\manage\view\base.html";i:1596192950;}*/ ?>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
	<meta name="renderer" content="webkit">
<title>后台管理系统</title>
<link rel="stylesheet" href="/static/public/awesome/css/font-awesome.min.css" />

<link rel="stylesheet" href="/static/public/layui/css/layui.css" />

<link rel="stylesheet" href="/static/public/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="/static/manage/css/style.css" />

	<link rel="stylesheet" href="/static/public/dist/zoomify.min.css">
	
<script src="/static/public/kindeditor/kindeditor-all.js"></script>
<script src="/static/public/kindeditor/lang/zh_CN.js"></script>
<script src="/static/public/ueditor/ueditor.config.js?t=<?php echo time();?>"></script>
<script src="/static/public/ueditor/ueditor.all.min.js"></script>
<script src="/static/public/ueditor/lang/zh-cn/zh-cn.js"></script>
</head>
<body>
<?php if($is_auth): ?>

<script src="/static/public/My97DatePicker/WdatePicker.js"></script>
<div class="g-main">
    <div class="m-main-title">
        <div class="m-container-fluid">
            <a href="<?php echo url('index/welcome'); ?>"><i class="icon icon-home"></i>首页</a>
            <span class="icon-angle-right"></span>
            <span>商城</span>
            <span class="icon-angle-right"></span>
            <span>活动管理</span>
            <span class="icon-angle-right"></span>
            <span><?php echo !empty($info) ? '编辑'  :  '添加'; ?>活动商品</span>
            <a class="u-flush"><i class="icon-repeat"></i></a>
        </div>
    </div>
    <div class="m-main-content">
        <div class="m-container">
            <div class="m-form">
                <form class="layui-form" id="j_form">
                    <table class="m-table">
                        <thead>
                        <tr>
                            <th colspan="2"><?php echo !empty($info) ? '编辑'  :  '添加'; ?>活动商品</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>

                            <td><label for="">活动名称<em>*</em></label></td>

                            <td>

                                <div class="lay-select">

                                    <select name="activity_id">

                                        <option value="0">请选择活动</option>

                                        <?php if(is_array($activity) || $activity instanceof \think\Collection || $activity instanceof \think\Paginator): if( count($activity)==0 ) : echo "" ;else: foreach($activity as $key=>$activity): ?>

                                        <option value="<?php echo htmlentities($activity['id']); ?>"<?php if($info['activity_id'] == $activity['id']): ?> selected<?php endif; ?>><?php echo htmlentities($activity['title']); ?></option>

                                        <?php endforeach; endif; else: echo "" ;endif; ?>

                                    </select>

                                </div>

                            </td>

                        </tr>
                        <tr id="j_member_points">
                            <td width="15%"><label for="goods_id">选择商品<em>*</em></label></td>
                            <td>

                                <input type="text" class="u-ipt u-ipt-longer" id="goods_id1" placeholder="请输入商品名称" readonly                                         <?php if(is_array($good) || $good instanceof \think\Collection || $good instanceof \think\Paginator): if( count($good)==0 ) : echo "" ;else: foreach($good as $key=>$goods): if($info['goods_id'] == $goods['id']): ?>value="<?php echo htmlentities($goods['goods_name']); ?>" <?php endif; endforeach; endif; else: echo "" ;endif; ?> />
                                <input type="hidden" class="u-ipt u-ipt-longer" name="goods_id" id="goods_id" placeholder="请输入商品名称" readonly value="<?php echo htmlentities($info['goods_id']); ?>" /><span><a class="u-edit" data-id="<?php echo htmlentities($info['goods_id']); ?>" data-key="goods_id">修改</a></span></td>
                        </tr>
                        <tr>
                            <td width="15%"><label for="goods_name">团购商品标题<em>*</em></label></td>
                            <td><input type="text" class="u-ipt u-ipt-longer" name="goods_name" id="goods_name" placeholder="请输入团购商品标题" value="<?php echo htmlentities($info['goods_name']); ?>" /></td>
                        </tr>
                        <tr>
                            <td width="15%"><label for="describe">团购商品描述<em>*</em></label></td>
                            <td><input type="text" class="u-ipt u-ipt-longer" name="describe" id="describe" placeholder="请输入团购商品描述" value="<?php echo htmlentities($info['describe']); ?>" /></td>
                        </tr>
                        <tr>
                            <td width="15%"><label for="promotion_price">团购价格<em>*</em></label></td>
                            <td><input type="text" class="u-ipt u-ipt-longer" name="promotion_price" id="promotion_price" placeholder="请输入团购价格" value="<?php echo htmlentities($info['promotion_price']); ?>" /></td>
                        </tr>
                        <tr>
                            <td width="15%"><label for="num">团购数量<em>*</em></label></td>
                            <td><input type="text" class="u-ipt u-ipt-longer" name="num" id="num" placeholder="请输入团购数量" value="<?php echo htmlentities($info['num']); ?>" /></td>
                        </tr>
                        <tr>
                            <td width="15%"><label for="list_order">排序<em>*</em></label></td>
                            <td><input type="text" class="u-ipt u-ipt-longer" name="list_order" id="list_order" placeholder="请输入活动排序" value="<?php echo htmlentities($info['list_order']); ?>" /></td>
                        </tr>
                        <!-- <tr>
                            <td width="15%"><label for="pbegin">开始时间</label></td>
                            <td><input type="text" name="pbegin" class="u-ipt u-ipt-long" id="pbegin" placeholder="开始时间" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="<?php echo !empty($info['pbegin']) ? date('Y-m-d',$info['pbegin'])  :  date('Y-m-d', time()); ?>" readonly=""></td>
                        </tr>
                        <tr>
                            <td width="15%"><label for="pend">结束时间</label></td>
                            <td><input type="text" name="pend" class="u-ipt u-ipt-long" id="pend" placeholder="结束时间" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="<?php echo !empty($info['pend']) ? date('Y-m-d',$info['pend'])  :  date('Y-m-d', time()); ?>" readonly=""><span>默认到所选日期的23:59:59</span></td>
                        </tr> -->
                        <input type="hidden" value="<?php echo !empty($info['register_time']) ? htmlentities($info['register_time']) :  time(); ?>" name="register_time" id="register_time"/>
                    </table>
                    <div class="m-form-btn"><input type="hidden" name="id" value="<?php echo htmlentities($info['id']); ?>"><button id="j_btn" class="u-btn">确定提交</button></div>
                </form>
            </div>
        </div>
    </div>
</div>

<?php endif; ?>
<input type="hidden" name="action_uri" value="<?php echo url('action'); ?>" />

<input type="hidden" name="redirect_uri" value="<?php echo url('index'); ?>" />

<input type="hidden" name="region_uri" value="/manage/regions/regions" />
<script src="/static/public/js/jquery-1.10.2.js"></script>
<script src="/static/public/js/maniac.ui.js"></script>
<script src="/static/public/layui/layui.js" charset="utf-8"></script>
<script src="/static/public/js/aes.js"></script>
<script src="/static/public/js/mode-ecb-min.js"></script>
<script src="/static/public/js/utils.js"></script>
<script src="/static/public/js/dialog.js"></script>
<script src="/static/manage/js/form.js"></script>
<script src="/static/manage/js/js.js"></script>
<script src="/static/public/js/app.js"></script>
<script src="/static/public/js/encrypt.js"></script>
<script src="/static/public/dist/zoomify.min.js"></script>
<script type="text/javascript">
    $('.fdzoom').zoomify();
</script>

<script>
var aesKey = '<?php echo htmlentities($encrypt_key); ?>';
    $(function(){
        layui.use('layer', function(){
            var user_exists = parseInt('<?php echo !empty($user_exists) ? 1  :  0; ?>');
            var user_forbidden = parseInt('<?php echo !empty($user_forbidden) ? 1  :  0; ?>');
            var quit_force = parseInt('<?php echo !empty($quit_force) ? 1  :  0; ?>');
            var is_auth    = parseInt('<?php echo !empty($is_auth) ? 1  :  0; ?>');
            
            if (user_exists) {
                dialog.error('您所登录的用户已被删除', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }
            
            if (user_forbidden) {
                dialog.error('您的账户已被禁用', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }

            if (quit_force) {
                dialog.error('同一账户同一时间只能一人在线', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }
            
            if (!is_auth) {
                dialog.error('您没有权限执行此操作', function(){
                    window.location.href = history.go(-1);
                    return false;
                });
            }
        });
    })
</script>

<script>
    layui.use(['layer', 'form', 'upload'], function() {
        $('.u-edit').on('click', function () {
            var $input = $(this).parent().prev();
            var $that = $(this);
            var key = $that.attr('data-key');
            var id = $that.attr('data-id');
            var title = key == 'points' ? '搜索商品名' : '搜索商品名';

            layer.open({
                type: 1,
                title: title,
                skin: 'layui-layer-rim', //加上边框
                area: ['420px', '400px'], //宽高
                content: '<div class="m-edit-form"><input type="text" id="name" class="u-ipt name"><p>直接输入要搜索的商品名</p><input type="button" class="u-btn" id="sousuo"  value="搜索" /></div>'
            });
        });
        /*点击搜索  搜索商品名*/
        $('body').on('click', '#sousuo', function () {
            var html = '';
            $('.m-edit-form p:nth-of-type(2)').remove();
            $('.m-edit-form input:nth-of-type(3)').remove();
            var name = $(this).parent('.m-edit-form').find('.name').val();
            $.post('<?php echo url("goods"); ?>', {name:name}, function (ret) {
                if (ret) {
                    var obj = eval(ret);
                    html += "<p>";
                    for(var i=0; i<obj.length; i++)
                    {
                        var id = obj[i].id;
                        var goodsname = obj[i].goods_name;
                        html += '<input type="radio" name="a" value="' + goodsname + '" data="' + id + '"/>' + goodsname     ;
                    }
                    html += "</p><input type=\"button\" class=\"u-btn\" id=\"tijiao\"  value=\"提交\" />";
                    $('.m-edit-form').append(html);
                }
            }, 'json');
        });
        /*点击弹框的提交*/
        $('body').on('click', '#tijiao', function () {
            $("input[name='a']:checked").each(function(){
                $('#goods_id1').val($(this).val());
                $('#goods_id').val($(this).attr('data'));
            })
            layer.closeAll();
        });
    })
</script>

</body>
</html>